<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
			<h:form id="searchOperation">	
				<h2>#{msg.searchUserAccount}</h2>  			
		     	<h:panelGrid columns="2">
		     		<h:outputLabel value="#{msg.first_name}" />
		     		<p:inputText value="#{searchOperationMB.userFilter.firstName}"/>
		     		
		     		<h:outputLabel value="#{msg.last_name}" />  
				    <p:inputText value="#{searchOperationMB.userFilter.lastName}" />
		            
		            <h:outputLabel value="#{msg.documentType}"/>
		     		<p:selectOneMenu value="#{searchOperationMB.userFilter.documentType}">
		     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
		                <f:selectItems value="#{searchOperationMB.documents}" />   
		            </p:selectOneMenu> 
		            
		     		<h:outputLabel value="#{msg.documentNum}" />
				    <p:inputText value="#{searchOperationMB.userFilter.dni}" onkeypress="javascript:return isAlphanumericKey(event);"/>
		            
				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
	     			<r:commandLinkCustom id="reset" action="#{searchOperationMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}"/>
     				<r:commandLinkCustom id="search" action="#{searchOperationMB}" method="search" icon="icon-search" message="#{msg.searchButton}"/>
	     	 	</h:panelGrid>
	     	 	
	     	 	<p:blockUI block="userTable" trigger="userTable">  
			        #{msg.loading}<br />  
			        <p:graphicImage value="/images/ajax-loader.gif"/>  
			    </p:blockUI>
	     	 	<p:dataTable var="user" value="#{searchOperationMB.userLazyDataModel}" 
	     	 		style="padding-top:15px" paginator="true" lazy="true" id="userTable"
	     	 		rows="10"
	     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}">
	 
	 		 		<p:column headerText="#{msg.full_name}" style="width:30%">  
		            	<h:outputText value="#{user.getFullName()}" />   
	        		</p:column> 
	 
	 				<p:column headerText="#{msg.documentType}" style="width:7%">  
		            	<h:outputText value="#{searchOperationMB.obtainDescription(user.documentType.description)}" />   
	        		</p:column> 
	        		
			        <p:column headerText="#{msg.documentNum}" style="width:20%" sortBy="#{user.dni}">  
		            	<h:outputText value="#{user.dni}" />   
	        		</p:column> 
	        		
	        		<p:column headerText="#{msg.email}" style="width:10%" >  
		            	<h:outputText value="#{user.getDefaultEmail().email}" />   
	        		</p:column>
	        		
	        		<p:column style="width:10%" >
	        			<center>
		        			<h:commandLink action="#{searchOperationMB.viewDetails(user)}" ajax="false" process="@form">
			        			<i class="icon-zoom-in icon-2x color-zoom"></i>
			        		</h:commandLink>
			        		
			        		<r:space/><r:space/>
			        		
			        		<h:commandLink action="#{searchOperationMB.addOperation(user)}" ajax="false" process="@form">
		        				<i class="icon-money icon-2x color-cost"></i>
		        			</h:commandLink>
	        			</center>
	        		</p:column>
			    </p:dataTable>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
